package com.example.springboot_demo.demos.web.book_work.Mapper;


import com.example.springboot_demo.demos.web.book_work.Pojo.entity.Book;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface BookMapper {

    @Select("select * from book")
    List<Book> selectAllBooks();

    @Select("select * from book where id = #{id}")
    Book selectBookById(Integer id);

    @Update("update book set title = #{title}, author = #{author}, stock = #{stock}, status = #{status} where id = #{id}")
    void updateBook(Book book);
}
